// Mock: user/login

const token = 'admin-token'

interface reqBody {
  username: string
  password: string
}

interface reqType {
  body: reqBody
}

export default [
  {
    url: '/mockapi/user/login',
    method: 'post',
    response: (req) => {
      console.log(req)
      const { username, password } = (req as reqType).body
      if (username === 'admin' && password === 'admin') {
        return {
          code: 200,
          data: { token: token },
        }
      } else {
        return {
          code: 60204,
          message: 'Account and password are incorrect.',
        }
      }
    },
  },
]
